/* GUI CONVERTED from ppptrp.p (converter v1.76) Tue Jul 16 02:57:49 2002 */
/* ppptrp.p - ITEM MASTER REPORT                                          */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                    */
/* All rights reserved worldwide.  This is an unpublished work.           */
/* $Revision: 1.24.2.8 $                                                       */
/*V8:ConvertMode=FullGUIReport                                            */
/* REVISION: 1.0      LAST MODIFIED: 01/04/86   BY: PML                   */
/* REVISION: 7.0      LAST MODIFIED: 09/04/91   BY: pma *F003*            */
/* REVISION: 7.3      LAST MODIFIED: 09/17/92   BY: pma *G068*            */
/* REVISION: 7.3      LAST MODIFIED: 08/27/94   BY: rxm *GL58*            */
/* REVISION: 7.2      LAST MODIFIED: 03/03/95   BY: qzl *F0LG*            */
/* REVISION: 7.5      LAST MODIFIED: 02/01/95   BY: tjm *J042*            */
/* REVISION: 8.6      LAST MODIFIED: 10/10/97   BY: mzv *K0QN*            */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007*  A. Rahane     */
/* REVISION: 8.6E     LAST MODIFIED: 03/12/98   BY: *J2G9*  Sachin Shah   */
/* REVISION: 8.6E     LAST MODIFIED: 04/02/98   BY: *J2HY*  A. Licha      */
/* REVISION: 8.6E     LAST MODIFIED: 04/08/98   BY: *J2JP*  A. Licha      */
/* REVISION: 8.6E     LAST MODIFIED: 04/07/98   BY: *L00M*  DS            */
/* REVISION: 8.6E     LAST MODIFIED: 04/07/98   BY: *L00Z*  DS            */
/* REVISION: 8.6E     LAST MODIFIED: 06/24/98   BY: *L01G* R. McCarthy    */
/* REVISION: 8.6E     LAST MODIFIED: 06/25/98   BY: *L03V*  Brenda Milton */
/* REVISION: 8.6E     LAST MODIFIED: 09/08/98   BY: *L08W* Russ Witt      */
/* REVISION: 9.0      LAST MODIFIED: 01/19/00   BY: *J3NQ* Jyoti Thatte   */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 07/20/00   BY: *N0GF* Mudit Mehta      */
/* REVISION: 9.1      LAST MODIFIED: 08/13/00   BY: *N0KQ* myb              */
/* REVISION: 9.1      LAST MODIFIED: 08/23/00   BY: *N0N5* Arul Victoria   */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Revision: 1.24.2.6  BY: Robin McCarthy        DATE: 02/07/02  ECO: *P000*  */
/* $Revision: 1.24.2.8 $    BY: K Paneesh             DATE: 07/09/02  ECO: *N1NR*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* DISPLAY TITLE */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE ppptrp_p_1 "Type!Rev"
/* MaxLen: Comment: */

&SCOPED-DEFINE ppptrp_p_2 "Group!Status"
/* MaxLen: Comment: */

&SCOPED-DEFINE ppptrp_p_4 "Drawing!Brk Cat"
/* MaxLen: Comment: */

&SCOPED-DEFINE ppptrp_p_5 "Print Comments"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/* THESE ARE NEEDED FOR FULL GUI REPORTS */
{gprunpdf.i "mcpl" "p"}
{gprunpdf.i "mcui" "p"}

define variable line like pt_prod_line.
define variable line1 like pt_prod_line.
define variable part like pt_part.
define variable part1 like pt_part.
define variable type like pt_part_type.
define variable type1 like pt_part_type.
define variable ptgroup like pt_group.
define variable group1 like pt_group.
define variable added like pt_added initial ?.
define variable added1 like pt_added initial ?.
define variable cmmts like mfc_logical label {&ppptrp_p_5}.
define variable i as integer.
define variable pldesc like pl_desc.
define variable pstatus LIKE pt_status.   /*glx*/
DEFINE VARIABLE pstatus1 LIKE pt_status.  /*glx*/  

{etvar.i &new = "new"}        /* COMMON EURO VARIABLES */
{etrpvar.i &new = "new"}      /* COMMON EURO REPORT VARIABLES*/
{eteuro.i}                    /* GET COMMON USED EURO INFORMATION*/
define variable et_pt_price   like pt_price       no-undo.
define variable et_glxcst     like glxcst         no-undo.

/* SELECT FORM */

/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
   line           colon 15
   line1          label {t001.i} colon 49 skip
   part           colon 15
   part1          label {t001.i} colon 49 skip
   type           colon 15
   type1          label {t001.i} colon 49 skip
   ptgroup        colon 15
   group1         label {t001.i} colon 49 SKIP
   pstatus        colon 15                             /*glx*/
   pstatus1       label {t001.i} colon 49 SKIP         /*glx*/   
   added          colon 15
   added1         label {t001.i} colon 49 skip(1)
   cmmts          colon 30
   et_report_curr colon 30

 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/* REPORT BLOCK */

{wbrp01.i}

/*GUI*/ {mfguirpa.i true "printer" 132 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

   if part1 = hi_char then part1 = "".
   if line1 = hi_char then line1 = "".
   if type1 = hi_char then type1 = "".
   if group1 = hi_char then group1 = "".
   IF pstatus1 = hi_char THEN pstatus1 = "". /*glx*/
   if added1 = hi_date then added1 = ?.
   if added  = low_date then added = ?.

   if c-application-mode <> 'web' then
   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   {wbrp06.i &command = update &fields = "  line line1 part part1 type
        type1 pstatus pstatus1 ptgroup group1 added added1 cmmts
        et_report_curr /* when (et_tk_active) */
        " &frm = "a"}

   if (c-application-mode <> 'web') or
      (c-application-mode = 'web' and
      (c-web-request begins 'data')) then do:

      bcdparm = "".
      {mfquoter.i line   }
      {mfquoter.i line1  }
      {mfquoter.i part   }
      {mfquoter.i part1  }
      {mfquoter.i type   }
      {mfquoter.i type1  }
      {mfquoter.i ptgroup}
      {mfquoter.i group1 }
      {mfquoter.i pstatus}     /*glx*/
      {mfquoter.i pstatus1}    /*glx*/
      {mfquoter.i added  } 
      {mfquoter.i added1 }
      {mfquoter.i cmmts  }  
      {mfquoter.i et_report_curr}

      if et_report_curr <> "" then do:
         {gprunp.i "mcpl" "p" "mc-chk-valid-curr"
            "(input et_report_curr,
              output mc-error-number)"}

         if mc-error-number = 0
            and et_report_curr <> base_curr then do:
            {gprunp.i "mcpl" "p" "mc-create-ex-rate-usage"
               "(input et_report_curr,
                 input base_curr,
                 input "" "",
                 input et_eff_date,
                 output et_rate2,
                 output et_rate1,
                 output mc-seq,
                 output mc-error-number)"}
         end.  /* if mc-error-number = 0 */

         if mc-error-number <> 0 then do:
            {pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=3}
            if c-application-mode = 'web' then return.
            else /*GUI NEXT-PROMPT removed */
            /*GUI UNDO removed */ RETURN ERROR.
         end.  /* if mc-error-number <> 0 */
         else if et_report_curr <> base_curr then do:
            {gprunp.i "mcui" "p" "mc-ex-rate-output"
               "(input et_report_curr,
                 input base_curr,
                 input et_rate2,
                 input et_rate1,
                 input mc-seq,
                 output mc-exch-line1,
                 output mc-exch-line2)"}
            {gprunp.i "mcpl" "p" "mc-delete-ex-rate-usage"
               "(input mc-seq)"}
         end.
      end.  /* if et_report_curr <> "" */
      if et_report_curr = "" or et_report_curr = base_curr then assign
         mc-exch-line1 = ""
         mc-exch-line2 = ""
         et_report_curr = base_curr.

   end.  /* if c-application-mode <> 'web' */

   /* PRINTER SELECTION */
   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 132 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:



   {mfphead.i}

   if part1 = "" then part1 = hi_char.
   if line1 = "" then line1 = hi_char.
   if type1 = "" then type1 = hi_char.
   if group1 = "" then group1 = hi_char.
   if pstatus1 = "" then pstatus1 = hi_char.      /*glx*/    
   if added = ? then added = low_date.
   if added1 = ? then added1 = hi_date.
   if et_report_curr = "" then et_report_curr = base_curr.

   for each pt_mstr
         fields(pt_abc pt_added pt_avg_int pt_break_cat pt_cyc_int
         pt_desc1 pt_desc2 pt_draw pt_group pt_loc pt_part
         pt_part_type pt_pm_code pt_price pt_prod_line pt_rev
         pt_site pt_status pt_um)
         where (pt_part >= part and pt_part <= part1)
         and (pt_prod_line >= line and pt_prod_line <= line1)
         and (pt_part_type >= type and pt_part_type <= type1)
         and (pt_group >= ptgroup and pt_group <= group1)
         and (pt_status >= pstatus and pt_group <= pstatus1)  /*glx*/
         and ((pt_added  >= added and pt_added <= added1) or pt_added = ?)
         no-lock use-index pt_prod_part
         break by pt_prod_line by pt_part with frame b width 132 down:

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame b:handle).
      if first-of (pt_prod_line) then do with frame c:
         if page-size - line-counter < 7 then page.
         find pl_mstr where pl_prod_line = pt_prod_line no-lock.
         pldesc = pl_desc.
         /* SET EXTERNAL LABELS */
         setFrameLabels(frame c:handle).
         display skip(1) pt_prod_line pl_desc no-label
            skip(1) mc-curr-label no-label et_report_curr no-label skip
            mc-exch-label no-label mc-exch-line1 no-label skip
            mc-exch-line2 no-label at 23 skip(1)
         with frame c side-labels
            no-box STREAM-IO /*GUI*/ .
      end.  /* if first-of (pt_prod_line) */

      FORM /*GUI*/ 
         header
         skip(1)
         pt_prod_line pldesc "(" + getTermLabel("CONTINUED",20) +
         ")" format "x(22)"
         skip(1) mc-curr-label et_report_curr skip
         mc-exch-label mc-exch-line1 skip
         mc-exch-line2 at 23 skip(1)
      with STREAM-IO /*GUI*/  frame a1 page-top side-labels width 132.

      view frame a1.

      if page-size - line-counter < 3 then page.

      for first in_mstr
         fields(in_abc in_cur_set in_gl_set in_part in_site
                in_gl_cost_site)
         where in_part = pt_part and in_site = pt_site no-lock:
      end.

      /*RETURN OLD GL COST TOTAL AS GLXCST*/
      {gpsct03.i &cost=sct_cst_tot}

      if et_report_curr <> base_curr then do:
         {gprunp.i "mcpl" "p" "mc-curr-conv"
            "(input base_curr,
              input et_report_curr,
              input et_rate1,
              input et_rate2,
              input pt_price,
              input true,   /* ROUND */
              output et_pt_price,
              output mc-error-number)"}

         if mc-error-number <> 0 then do:
            {pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2}
         end.

         {gprunp.i "mcpl" "p" "mc-curr-conv"
            "(input base_curr,
              input et_report_curr,
              input et_rate1,
              input et_rate2,
              input glxcst,
              input true,   /* ROUND */
              output et_glxcst,
              output mc-error-number)"}

         if mc-error-number <> 0 then do:
            {pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2}
         end.
      end.  /* if et_report_curr <> base_curr */

      display  pt_part  format "X(26)"
         pt_um
         pt_part_type
         column-label {&ppptrp_p_1}
         pt_group
         column-label {&ppptrp_p_2}
         pt_draw
         column-label {&ppptrp_p_4}
         pt_loc pt_pm_code
         pt_abc pt_avg_int pt_cyc_int
         if et_report_curr <> base_curr then
         et_pt_price
         else pt_price @ et_pt_price
         if et_report_curr <> base_curr then
         et_glxcst
         else glxcst @ et_glxcst WITH STREAM-IO /*GUI*/ .

      down 1.
      display "  " + pt_desc1 @ pt_part
         pt_rev @ pt_part_type
         pt_status @ pt_group
         pt_site @ pt_loc
         pt_break_cat @ pt_draw WITH STREAM-IO /*GUI*/ .
      if pt_desc2 <> "" then do:
         down 1.
         display "  " + pt_desc2 @ pt_part WITH STREAM-IO /*GUI*/ .
      end.

      /*PRINT COMMENTS */
      if cmmts = yes then do:
         for each cd_det no-lock where cd_ref = pt_part
            with frame e side-labels width 132 no-attr-space:

            do with frame d:
               /* SET EXTERNAL LABELS */
               setFrameLabels(frame d:handle).
               display space(5) cd_type cd_lang (cd_seq + 1) @ cd_seq
               with frame d side-labels STREAM-IO /*GUI*/ .
            end.  /* do with frame d */

            do i = 1 to 15 with frame e down:

               if cd_cmmt[i] > ""
               then
                  display
                  space(5)
                  cd_cmmt[i] no-label WITH STREAM-IO /*GUI*/ .
               if cd_cmmt[i] > ""
               then
                  down 1.
            end. /* DO i = 1 to 15 WITH FRAME E DOWN..*/
         end.  /* for each cd_det */
      end.  /* if cmmts = yes */

      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/


   end.  /* for each pt_mstr */

   /* REPORT TRAILER */
   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


end.  /* repeat */

{wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" line line1 part part1 type type1 ptgroup group1 pstatus pstatus1 added added1 cmmts et_report_curr "} /*Drive the Report*/
